using QAssetBundle;
using QFramework;

namespace HareGame
{

    public partial class DataManager
    {
        /// <summary>
        /// 当前玩家钞票数量
        /// </summary>
        public double Money
        {
            get
            {
                return GameEntry.GameData.GetDouble(UserData.Money, 500);
            }
            set
            {
                GameEntry.GameData.SetDouble(UserData.Money, value);
            }
        }

        /// <summary>
        /// 当前玩家钻石数量
        /// </summary>
        public double Diamond
        {
            get
            {
                return GameEntry.GameData.GetDouble(UserData.Diamond, 0);
            }
            private set
            {
                GameEntry.GameData.SetDouble(UserData.Diamond, value);
            }
        }

        /// <summary>
        /// 分钟收益
        /// </summary>
        public double MinuteGains
        {
            get
            {
                return 0;
            }
            set
            {

            }
        }

        /// <summary>
        /// 添加钞票
        /// </summary>
        /// <param name="value">额度</param>
        /// <param name="needRefreshUI">是否需要立即刷新UI</param>
        /// <param name="canBreak">是否能突破上限</param>
        public void AddMoney(double value, bool needRefreshUI = false)
        {
            Money += value;

            if (needRefreshUI)
                GameEntry.Event.Send(EventID.RefreshDataUI);
        }

        /// <summary>
        /// 使用钞票
        /// </summary>
        /// <param name="value">额度</param>
        public void UseMoney(double value)
        {
            Money -= value;
            GameEntry.Event.Send(EventID.RefreshDataUI);
        }

        /// <summary>
        /// 添加钻石
        /// </summary>
        /// <param name="value">额度</param>
        public void AddDiamond(double value)
        {
            Diamond += value;
            GameEntry.Event.Send(EventID.RefreshDataUI);
        }

        /// <summary>
        /// 使用钻石
        /// </summary>
        /// <param name="value">额度</param>
        public void UseDiamond(double value)
        {
            Diamond -= value;
            GameEntry.Event.Send(EventID.RefreshDataUI);
        }
    }
}
